package com.hunt.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hunt.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Api("股票所属概念")
@Controller
@RequestMapping("/app/ideablock")
public class BlockOrigionController extends BaseController{
    @Resource
    private RedisTemplate stringredisTemplate;
    private static final Logger log = LoggerFactory.getLogger(BlockOrigionController.class);

    @ApiOperation(value = "股票所属概念查询", httpMethod = "GET", produces = "application/json", response = Result.class)
    @ResponseBody
    @RequestMapping(value = "findideablock", method = RequestMethod.GET)
    public Result findideablock(@RequestParam(value = "code",required = true) String code) {
        String message=stringredisTemplate.opsForHash().get("Block_Origin",code).toString();
        JSONObject result=JSON.parseObject(message );
        return Result.success(result);
    }
}
